home *** CD-ROM | disk | FTP | other *** search
- /* TextWindow.c */
- /*
- * TextWindow
- * Superclass: CDirector.
- * Copyright © 1991 Martin Minow. All Rights Reserved.
- * All use and non-commercial distribution permitted.
- * Set tabs every 4 bytes.
- *
- * This is a very simple text-only, output-only, display
- * window. It intentionally does not support cut/paste,
- * filing and printing. It is based on the design of
- * the TCL CClipboard class. In fact, if I was cleverer,
- * I'd make this a sub-class of CClipboard.
- */
-
- #ifdef DOCUMENTATION
-
- title TextWindow
- superclass CDirector
- subclasses none
-
- usage
-
- #include "TextWindow.h"
-
- void ITextWindow(
- CApplication *aSupervisor,
- short aWindowId,
- Boolean isFloating,
- Boolean hideOnSuspend,
- long toggleCmd,
- short showHideRes,
- StringPtr fontName,
- short fontSize
- );
- Initialization. itsSupervisor must be the
- application. It displays the window defined
- by aWindowId. Text is written in the indicated
- font and size. The toggleCmd and showHideRes
- parameters are described in the AuxWindow class.
-
- void Dispose(void);
- Dispose of the window and its contents.
-
- void SetText(
- StringPtr someText
- );
- Put a line of text on the screen.
- It rolls text up the display.
-
- StringHandle GetText(
- short index
- );
- Get the StringHandle for the specified line.
-
- author
- Martin Minow
-
- copyright
- Copyright © 1991 Martin Minow. All Rights Reserved.
- Non-commercial use and distribution permitted.
-
- #endif
-
- #include <CBureaucrat.h>
- #include <CDecorator.h>
- #include <CTextEnvirons.h>
- #include <TBUtilities.h>
- #include "TextWindow.h"
-
- extern CBureaucrat *gGopher;
- extern CDecorator *gDecorator;
-
- #define itsTextInfo ((CTextEnvirons *) itsEnvironment)
-
- /*
- * Initialize the TextWindow.
- */
- void
- TextWindow::ITextWindow(
- CApplication *aSupervisor, /* The app. */
- short aWindowId, /* WIND res. */
- Boolean isFloating, /* Floating? */
- Boolean hideOnSuspend, /* Mac-like? */
- long toggleCmd, /* Show/hide it */
- short showHideRes, /* STR# text */
- StringPtr fontName, /* Font name */
- short fontSize /* Font size */
- )
- {
- Rect windowBox;
-
- AuxWindow::IAuxWindow( /* Init superclass */
- aSupervisor, /* Supervisor */
- aWindowId, /* Enclosure */
- isFloating, /* Does it float? */
- hideOnSuspend, /* Mac-like? */
- toggleCmd, /* Our command */
- showHideRes /* Menu text STR# */
- );
- gDecorator->CenterWindow(itsWindow);
- itsWindow->GetAperture(&windowBox);
- itsTextPane = new(TextPane);
- itsTextPane->ITextPane(
- itsWindow, /* Enclosure */
- this, /* Enclosure */
- windowBox.right - windowBox.left, /* Width */
- windowBox.bottom - windowBox.top, /* Height */
- 0, 0, /* Offset in enclosure */
- sizFIXEDLEFT, sizFIXEDTOP,
- fontName,
- fontSize
- );
- }
-
- /*
- * The SetText method adds text to the data pane.
- */
- void
- TextWindow::SetText(
- StringPtr someText
- )
- {
- itsTextPane->SetText(someText);
- }
-
-
-